"""
# -*- coding: utf-8 -*-
# @Time    : 2023/5/21 22:02
# @Author  : 王摇摆
# @FileName: Import.py
# @Software: PyCharm
# @Blog    ：https://blog.csdn.net/weixin_44943389?type=blog
"""
import numpy as np


def buildLine(W, b, start, end, size=100):
    """
    构建一条指定的直线
    args:
        W - 权重系数
        b - 偏移量
        start - 最小值
        end - 最大值
        size - 组成线的点的数量
        w0 * x0 + w1 * x1 + b = 0
    """
    x0 = np.linspace(start, end, size)
    if W[1] == 0:
        x0 = np.ones(size) * (-b / W[0])
        x1 = np.zeros(size)
    else:
        x1 = -(b + W[0] * x0) / W[1]
    return x0, x1

import numpy as np
from sklearn.datasets import make_classification

X, y = make_classification(n_features = 2, n_informative = 2, n_redundant = 0, n_samples = 200, n_classes = 2, random_state = 0)
y[y == 0] = -1
